package com.iflytek.autofly.setting.biz;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.iflytek.autofly.setting.R;

/**
 * <b>Description: </b>主activity<br/>
 * <b>Change History:</b><br/>
 * <table border="1">
 * <tr>
 * <td><b>user</b></td>
 * <td><b>date</b></td>
 * <td><b>time</b></td>
 * <td><b>reason</b></td>
 * </tr>
 * <tr>
 * <td>JunLuan@iflytek.com</td>
 * <td>2015年5月26日</td>
 * <td>上午11:25:14</td>
 * <td>创建此文件</td>
 * </tr>
 * </table>
 *
 * @author JunLuan@iflytek.com
 */
public class MassiveMessageActivity extends Activity {

    public static final String TAG = "MassiveMessageActivity";
    public static final String TITLE = "title";
    public static final String CONTENT = "content";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = this.getIntent();
        String title = intent.getStringExtra(TITLE);
        String content = intent.getStringExtra(CONTENT);

        setContentView(R.layout.massive_message);

        TextView titleTv = (TextView) findViewById(R.id.title_tv);
        titleTv.setText(title);
        TextView contentTv = (TextView) findViewById(R.id.content_tv);
        contentTv.setText(content);

        final ImageView closeIv = (ImageView) findViewById(R.id.closeIv);

        closeIv.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_UP:
                        closeIv.setAlpha(1.0f);
                        break;
                    case MotionEvent.ACTION_DOWN:
                        closeIv.setAlpha(0.3f);
                        break;
                }
                return false;
            }
        });
        closeIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
